package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	http.HandleFunc("/test1/", handler1)
	http.HandleFunc("/test2/", handler2)
	http.ListenAndServe("127.0.0.1:9999", nil)
}

func handler2(writer http.ResponseWriter, request *http.Request) {
	query := request.URL.Query()
	fmt.Println(query.Get("name"))
	fmt.Println(query.Get("age"))
	fmt.Println(request.URL)
	fmt.Println(request.Method)
	fmt.Println(ioutil.ReadAll(request.Body))
	writer.Write([]byte("ok"))
}

func handler1(writer http.ResponseWriter, request *http.Request) {
	writer.Write([]byte("<h1>hello world</h1>"))
}
